/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						       recruit_dialog.h

	$Header: /game/recruit_dialog.h $

	$NoKeywords: $

 ************************************************************************/
#ifndef RECRUIT_DIALOG_H_INCLUDED
#define RECRUIT_DIALOG_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

// kill the 255+ character identifier warning.  Templates tend to exceed that easily.
#pragma warning( disable: 4786 )

#include <vector>
#include "bitmap_group_ptr.h"
#include "bitmap_layer_window.h"
#include "bitmap_layer_window_ptr.h"
#include "dialog_box.h"
#include "font_cache.h"
#include "material_array.h"
#include "scrollbar_ptr.h"
#include "skill_icon_ptr.h"
#include "text_window_ptr.h"

class  t_combat_model_window;
enum   t_creature_type;
struct t_creature_traits;

// ---------------------------------------------------------------------
// recruit creatures dialog
// ---------------------------------------------------------------------
class t_recruit_dialog : public t_bitmap_layer_window
{
public:
	t_recruit_dialog( t_window* parent, t_creature_type creature_type, int maximum,
		              t_material_array const& budget, int gold_cost = -1 );

	int              get_amount() const;
	t_creature_type  get_creature_type() const;
	t_material_array get_total_cost() const;

protected:
	t_recruit_dialog( t_window* parent, t_creature_type creature_type, int maximum,
		              t_material_array const& budget, t_bitmap_group_ptr bitmaps,
					  int gold_cost );

	void           add_ability_icons();
    void           add_cost_icons( std::string const& base_name, t_window_list&	icons, 
								   std::vector<t_text_window*>& numbers, std::string const& help_name );
	t_text_window* add_number( int number, std::string const& layer_name, int lines );
    t_text_window* add_text( std::string const& text, std::string const& layer_name, 
	                         int lines, int on_line );
	t_text_window* add_text( std::string const& text, std::string const& layer_name, 
		                     int lines );
	void           cancel_clicked( t_button* button );
	void           create_buttons();
	void           create_icons();
	void           create_text();
	void		   initialize( t_creature_type			creature_type, 
							   int						maximum,
		                       t_material_array const&	budget, 
							   t_bitmap_group_ptr		bitmaps,
							   int						gold_cost );
		                       
	void           maximum_clicked( t_button* button );
	void           purchase_clicked( t_button* button );
    void           set_ability_icons();
	void           set_cost_windows( std::vector<t_text_window*>& numbers,
		                             t_material_array const& cost );
	void		   set_creature( t_creature_type creature_type, int maximum,
								 int gold_cost );
    void           set_stats();
	void           slider_change( t_scrollbar* scrollbar, int value );

	t_skill_icon_ptr				m_ability_icons[4];	// will ever only display a max of 4 of the available skills
	int								m_amount;
	int								m_available;
	t_text_window_ptr				m_available_number;
	t_material_array				m_budget;
	t_material_array				m_cost;
	t_window_list			        m_cost_icons;
	std::vector<t_text_window*>		m_cost_numbers;
	t_combat_model_window*			m_creature_display;
	t_creature_type					m_creature_type;
	t_bitmap_group_ptr				m_layout;
	t_bitmap_group_ptr				m_material_icons;
	int								m_maximum;
	t_button*						m_purchase_button;
	t_text_window_ptr				m_recruit_number;
	t_scrollbar_ptr					m_scrollbar;
	t_text_window*					m_title;
	t_window_list			        m_total_cost_icons;
	std::vector<t_text_window*>		m_total_cost_numbers;
	t_creature_traits const*		m_traits;
    
    t_text_window*			        m_damage;
    t_text_window*			        m_hitpoints;
    t_text_window*			        m_movement;
    t_text_window*			        m_melee_offense;
    t_text_window*			        m_melee_defense;
    t_text_window*			        m_ranged_offense;
    t_text_window*			        m_ranged_defense;
    t_text_window*			        m_shots;
    t_text_window*			        m_speed;
    t_skill_icon_ptr                m_skill_icons[4];
};

// ---------------------------------------------------------------------
// inlines for t_recruit_dialog
// ---------------------------------------------------------------------
inline int t_recruit_dialog::get_amount() const
{
	return m_amount;
}

inline t_creature_type t_recruit_dialog::get_creature_type() const
{
	return m_creature_type;
}

inline t_material_array t_recruit_dialog::get_total_cost() const
{
	return m_cost * m_amount;
}

#endif // RECRUIT_DIALOG_H_INCLUDED
